/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cassys.delegates;

import cassys.dataaccess.DAOException;
import cassys.datatransferobjects.TeamDTO;
import cassys.ejb.sessionbean.TeamBeanRemote;
import cassys.servicelocator.ServiceLocator;
import java.rmi.RemoteException;
import java.util.ArrayList;

/**
 *
 * @author ASUS
 */
public class TeamDelegate {
     private TeamBeanRemote teamBean = null;
    
    public ArrayList<TeamDTO> findAllTeams() throws DAOException {
        return teamBean.findAllTeams();
    }
   
    public ArrayList<TeamDTO> findAllTeamByModule(String moduleCode) throws DAOException{
        return teamBean.findAllTeamsByModule(moduleCode);
    }

    public TeamDelegate() {
        teamBean =  ServiceLocator.getInstance().lookupTeamBean();
    }
    
    
    
    
    public TeamDTO findTeambyId(String teamId) throws DAOException, RemoteException{
        TeamDTO team = null;
        team = teamBean.findTeam(teamId);
        return team;
    }

    public void insertTeam(TeamDTO team) throws DAOException, RemoteException {
        teamBean.insertTeam(team);
    }

    public void updateTeam(TeamDTO team) throws DAOException, RemoteException {
        teamBean.updateTeam(team);
    }
    
    public void deleteTeam(TeamDTO team) throws DAOException, RemoteException {
        teamBean.deleteTeam(team);
    }
}
